package com.health.warehouse.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.health.api.model.WareHouseItemEnums;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 仓库物品表
 * @TableName warehouse_items
 */
@TableName(value ="warehouse_items")
@Data
public class WarehouseItems implements Serializable {
    /**
     * 仓库物品唯一标识
     */
    @TableId(type = IdType.AUTO)
    private Long autoId;

    /**
     * 关联仓库ID
     */
    private Long warehouseId;

    /**
     * 医院ID
     */
    private Long hospitalId;

    /**
     * 物品名称
     */
    private String itemName;

    /**
     * 物品类别
     */
    private WareHouseItemEnums itemCategory;

    /**
     * 物品数量
     */
    private Integer itemQuantity;

    /**
     * 单位
     */
    private String unit;

    /**
     * 溯源批次号
     */
    private Long tractCode;

    /**
     * 有效期至
     */
    private Date expireDate;

    /**
     * 逻辑删除标志，1表示已删除
     */
    @TableLogic
    private Integer isDelete;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        WarehouseItems other = (WarehouseItems) that;
        return (this.getAutoId() == null ? other.getAutoId() == null : this.getAutoId().equals(other.getAutoId()))
            && (this.getWarehouseId() == null ? other.getWarehouseId() == null : this.getWarehouseId().equals(other.getWarehouseId()))
            && (this.getItemName() == null ? other.getItemName() == null : this.getItemName().equals(other.getItemName()))
            && (this.getItemCategory() == null ? other.getItemCategory() == null : this.getItemCategory().equals(other.getItemCategory()))
            && (this.getItemQuantity() == null ? other.getItemQuantity() == null : this.getItemQuantity().equals(other.getItemQuantity()))
            && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit()))
            && (this.getTractCode() == null ? other.getTractCode() == null : this.getTractCode().equals(other.getTractCode()))
            && (this.getExpireDate() == null ? other.getExpireDate() == null : this.getExpireDate().equals(other.getExpireDate()))
            && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAutoId() == null) ? 0 : getAutoId().hashCode());
        result = prime * result + ((getWarehouseId() == null) ? 0 : getWarehouseId().hashCode());
        result = prime * result + ((getItemName() == null) ? 0 : getItemName().hashCode());
        result = prime * result + ((getItemCategory() == null) ? 0 : getItemCategory().hashCode());
        result = prime * result + ((getItemQuantity() == null) ? 0 : getItemQuantity().hashCode());
        result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode());
        result = prime * result + ((getTractCode() == null) ? 0 : getTractCode().hashCode());
        result = prime * result + ((getExpireDate() == null) ? 0 : getExpireDate().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", autoId=").append(autoId);
        sb.append(", warehouseId=").append(warehouseId);
        sb.append(", itemName=").append(itemName);
        sb.append(", itemCategory=").append(itemCategory);
        sb.append(", itemQuantity=").append(itemQuantity);
        sb.append(", unit=").append(unit);
        sb.append(", batchNumber=").append(tractCode);
        sb.append(", expireDate=").append(expireDate);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}